package com.jinwei.qunguanjia.common.exception;

import com.jinwei.qunguanjia.common.enums.HttpResponseEnum;

public class GlobalExceptionHelper {

    public static ServiceException localServiceException(String msg) {
        return new ServiceException(HttpResponseEnum.INTERNAL_SERVER_ERROR.getCode(), msg);
    }

    public static ServiceException localServiceException(String code, String msg) {
        return new ServiceException(code, msg);
    }

    public static ServiceException localServiceException(String code, String msg, Object... args) {
        ServiceException serviceException = new ServiceException(code, msg);
        serviceException.setMsg(msg, args);
        return serviceException;
    }

    public static ServiceException localServiceException(ServiceException serviceException) {
        return serviceException;
    }

    public static ServiceException localServiceException(ServiceException serviceException, Object... args) {
        serviceException.setMsg(serviceException.getMsg(), args);
        return serviceException;
    }

}
